        /* 路由 */
import vue from 'vue'
import vueRouter from 'vue-router';

//导入的组件
const Home = () => import('views/home/Home.vue');
const Category = () => import('views/category/Category.vue');
const cart = () => import('views/cart/Cart.vue');
const Profile = () => import('views/profile/Profile.vue');
const Detail = () => import('views/detail/Detail');

vue.use(vueRouter)

const routes = [
  {
    path: '',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home
  },
  {
    path: '/category',
    component: Category
  },
  {
    path: '/cart',
    component: cart
  },
  {
    path: '/profile',
    component: Profile
  },
  {
    path: '/detail/:id',
    component: Detail
  }
]

const router = new vueRouter({
  routes,
  mode: 'history'
})

export default router;

